package com.ruoyi.common.constant;

import com.ruoyi.common.config.Global;
import lombok.AllArgsConstructor;
import lombok.Getter;

public class UploadConstants {

    @Getter
    @AllArgsConstructor
    public enum ModelTypeEnum {
        PRODUCT_CATEGORY_COVER(1) {
            @Override
            public String getUploadPath() {
                return Global.getProfile() + "/product/category";
            }
        },
        PRODUCT_COVER(2) {
            @Override
            public String getUploadPath() {
                return Global.getProfile() + "/product/cover";
            }
        },
        PRODUCT_MEMO(3) {
            @Override
            public String getUploadPath() {
                return Global.getProfile() + "/product/memo";
            }
        },
        PRODUCT_SHARE_POSTER(4) {
            @Override
            public String getUploadPath() {
                return Global.getProfile() + "/product/share_poster";
            }
        },
        PRODUCT_SKU_COVER(5) {
            @Override
            public String getUploadPath() {
                return Global.getProfile() + "/product/share_poster";
            }
        },
        SHOP_LOGO(11) {
            @Override
            public String getUploadPath() {
                return Global.getProfile() + "/shop/logo";
            }
        },
        SHOP_BUSINESS_LICENCE_IMG(12) {
            @Override
            public String getUploadPath() {
                return Global.getProfile() + "/shop/licence";
            }
        },
        SHOP_QR_CODE(13) {
            @Override
            public String getUploadPath() {
                return Global.getProfile() + "/shop/qr_code";
            }
        },
        SHOP_POSTER(14) {
            @Override
            public String getUploadPath() {
                return Global.getProfile() + "/shop/poster";
            }
        },
        SHOP_PAY_CERT(15) {
            @Override
            public String getUploadPath() {
                return Global.getProfile() + "/shop/cert";
            }
        },
        SHOP_PAY_QR_CODE(16) {
            @Override
            public String getUploadPath() {
                return Global.getProfile() + "/shop/pay";
            }
        },
        SHOP_ADVERTISEMENT(17) {
            @Override
            public String getUploadPath() {
                return Global.getProfile() + "/shop/advertisement";
            }
        },
        SHOP_APPLET_DEMO(17) {
            @Override
            public String getUploadPath() {
                return Global.getProfile() + "/shop/appletDemo";
            }
        },
        NOTICE_COVER(21) {
            @Override
            public String getUploadPath() {
                return Global.getProfile() + "/notice/cover";
            }
        },
        NOTICE_CONTENT(22) {
            @Override
            public String getUploadPath() {
                return Global.getProfile() + "/notice/content";
            }
        },
        MEMBER_AVATAR(31) {
            @Override
            public String getUploadPath() {
                return Global.getProfile() + "/member/avatar";
            }
        },
        COMMON_IMAGE(99) {
            @Override
            public String getUploadPath() {
                return Global.getProfile() + "/common/image";
            }
        },
        NULL(0) {
            @Override
            public String getUploadPath() {
                return "";
            }
        },
        ;

        private int modelValue;

        public abstract String getUploadPath();

        public static ModelTypeEnum match(int model) {
            for (ModelTypeEnum one : ModelTypeEnum.values()) {
                if (one.getModelValue() == model) {
                    return one;
                }
            }
            return ModelTypeEnum.NULL;
        }
    }
}
